<template>
  <welding-monitor-svg :dataList="dataList" :style="svgStyle"></welding-monitor-svg>
</template>
<script>
import WeldingMonitorSvg from '@/components/monitor-svg/welding-monitor-svg'
import { setInterval } from 'timers';
export default {
  name: 'WeldingWorkshopMonitor',
  components: { WeldingMonitorSvg },
  data() {
    return {
      svgStyle: {width: '100%', height: '100%'},
      // test
      dataList: [0, 1, 2],
      set: null
    }
  },
  mounted() {
    this.svgStyle.height = document.documentElement.clientHeight - 100 + 'px'
    this.set = setInterval(() => {
      this.dataList = this.randomData()
    }, 1000)
  },
  methods: {
    randomData() {
      // test
      const list = []
      for (let index = 0; index < 30; index++) {
        const element = Math.floor(Math.random() * 3);
        list.push(element)
      }
      return list
    }
  },
  destroyed() {
    clearInterval(this.set)
  }
}
</script>